package Day07.Demo03;

import java.util.Random;

/**
 * @author 韩映晖
 * @version 1.0
 * @date 2022/2/4 18:51
 */
public class Demo03Random {
    public static void main(String[] args) {
        int n  = 5;
        Random r = new Random();
        for (int i = 0; i < 100; i++) {
            int result = r.nextInt(n)+1;//整体加1了，左右两边区间都加1
            /*int result  = r.nextInt(n+1);//相当于是给n值加一，即右边界加了1，右边范围从5变为6*/
            System.out.println(result);
        }

    }
}
